package com.cfm.bombercool 
{
	
	import org.flixel.*;
	
	/**
	 * ...
	 * @author devninja
	 */
	public class Bomb extends FlxSprite
	{
		public var power:int;
		
		private var timeToLive:Number;
		private var playState:PlayState;
		
		public function Bomb(playState:PlayState, power:int, timeToLive:Number) 
		{
			loadGraphic(playState.GeneralPNG, true, true, 16, 16, true);
			addAnimation("idle", [72, 73, 74], 9, true);
			this.power = power;
			this.timeToLive = timeToLive;
			this.playState = playState;
			play("idle");
			
			moves = false;
		}
		
		override public function update():void {
			super.update();
			timeToLive -= FlxG.elapsed;
			
			if ( timeToLive <= 0 )
				playState.detonate(this);
		}
		
	}

}